package me.zingon.doc.constant;

import java.util.HashMap;
import java.util.Map;

public enum LockTypeEnum {
	 UNLOCK_CODE(0,"扫码"),UNLOCK_CAMERA(1,"相机联动");

	    Integer code;
	    String name;

	    LockTypeEnum(Integer code, String name) {
	        this.code = code;
	        this.name = name;
	    }

	    public Integer getCode() {
	        return code;
	    }

	    public void setCode(Integer code) {
	        this.code = code;
	    }

	    public String getName() {
	        return name;
	    }

	    public void setName(String name) {
	        this.name = name;
	    }

	    public static LockTypeEnum getByCode(Integer code){
	        for(LockTypeEnum lse:LockTypeEnum.values()){
	            if(lse.getCode().equals(code)){
	                return lse;
	            }
	        }
	        return null;
	    }
	    public static String getNameByCode(Integer code){
	        for(LockTypeEnum lse:LockTypeEnum.values()){
	            if(lse.getCode().equals(code)){
	                return lse.getName();
	            }
	        }
	        return "";
	    }
	    public static Map<String,String> toMap(){
	        Map<String,String> result=new HashMap<String, String>(LockTypeEnum.values().length);
	        for(LockTypeEnum lse:LockTypeEnum.values()){
	           result.put(lse.getCode().toString(),lse.getName());
	        }
	        return result;
	    }
}
